package algorithms.recursion;

import junit.framework.Assert;

public class FibonacciDemo {
	public static void main(String[] args) {
		Assert.assertEquals(0, fibo(0));
		Assert.assertEquals(1, fibo(1));
		Assert.assertEquals(1, fibo(2));
		Assert.assertEquals(55, fibo(10));

	}
	public static int fibo(int n) {
		if(n < 0) {
			throw new IllegalArgumentException();
		}
		if(n == 0) return 0;
		else if(n == 1) return 1;
		else {
			return fibo(n - 1) + fibo(n - 2);
		}
	}
}
